package com.gmall.java.streamGroupingBy;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

public class StreamTestGroupBy1 {


    public static void  结束操作_groupBy(){

        //List 产生流
        List<Integer> list = new ArrayList<>();
        list.add(12);
        list.add(6);
        list.add(10);
        list.add(6);
        list.add(9);
        list.add(16);
        Map<String, List<Integer>> collect = list.stream()
                .collect(Collectors.groupingBy(a -> a % 2 == 0 ? "偶数" : "奇数"));

        System.out.println(collect);
    }

    public static void main(String[] args) {
        结束操作_groupBy();
    }

}
